﻿namespace In66.Net.EventBus.Cap
{
    [Serializable]
    public class Event<T> where T : class
    {
        public Event()
        {
        }

        public Event(string source, T data)
        {
            EventSource = source;
            Data = data;
        }

        /// <summary>
        /// 事件Id
        /// </summary>
        public virtual string Id { get; set; } = Guid.NewGuid().ToString("N");
        /// <summary>
        /// 事件发生的时间
        /// </summary>
        public virtual DateTime OccurredDate { get; set; } = DateTime.Now;
        /// <summary>
        /// 触发事件的方法
        /// </summary>
        public virtual string EventSource { get; set; } = string.Empty;
        /// <summary>
        /// 处理事件的方法
        /// </summary>
        public virtual string EventTarget { get; set; } = string.Empty;
        /// <summary>
        /// 事件数据
        /// </summary>
        public T Data { get; set; } = default!;
    }
}
